package com.education.wisdom.service.impl;

import com.education.common.utils.Convert;
import com.education.wisdom.mapper.MicrolessonMapper;
import com.education.wisdom.pojo.Microlesson;
import com.education.wisdom.service.IMicrolessonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 免费公开课 服务层实现
 *
 * @author ruoyi
 * @date 2019-06-13
 */
@Service
public class MicrolessonServiceImpl implements IMicrolessonService {
    @Autowired
    private MicrolessonMapper microlessonMapper;

    /**
     * 查询免费公开课信息
     *
     * @param id 免费公开课ID
     * @return 免费公开课信息
     */
    @Override
    public Microlesson selectMicrolessonById(Integer id) {
        return microlessonMapper.selectMicrolessonById(id);
    }

    /**
     * 查询免费公开课列表
     *
     * @param microlesson 免费公开课信息
     * @return 免费公开课集合
     */
    @Override
    public List<Microlesson> selectMicrolessonList(Microlesson microlesson) {
        return microlessonMapper.selectMicrolessonList(microlesson);
    }

    /**
     * 新增免费公开课
     *
     * @param microlesson 免费公开课信息
     * @return 结果
     */
    @Override
    public int insertMicrolesson(Microlesson microlesson) {
        return microlessonMapper.insertMicrolesson(microlesson);
    }

    /**
     * 修改免费公开课
     *
     * @param microlesson 免费公开课信息
     * @return 结果
     */
    @Override
    public int updateMicrolesson(Microlesson microlesson) {
        return microlessonMapper.updateMicrolesson(microlesson);
    }

    /**
     * 删除免费公开课对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteMicrolessonByIds(String ids) {
        return microlessonMapper.deleteMicrolessonByIds(Convert.toStrArray(ids));
    }

    /**
     * 通过catalogId查询资源
     *
     * @param catalogId
     * @return
     */
    @Override
    public List<Microlesson> selectByCatalogId(Map<String,Object> map) {
        return microlessonMapper.selectByCatalogId(map);
    }

    @Override
    public List<Microlesson> selectByMap(Map<String, Object> map) {
        return microlessonMapper.selectByMap(map);
    }

    @Override
    public List<Microlesson> selectByLike(String name) {
        return microlessonMapper.selectByLike(name);
    }

    @Override
    public List<Microlesson> selectCollection(String userId) {
        return microlessonMapper.selectCollection(userId);
    }

    @Override
    public List<Microlesson> selectByUserIdToFreeCatalogId(String userId) {
        return microlessonMapper.selectByUserIdToFreeCatalogId(userId);
    }

}
